﻿@model List<Yuebon.Security.Dtos.MenuOutputDto>

@foreach (var menu in Model)
{
    var isActive = ViewBag.CurrentMenuP== menu.EnCode; //判断当前功能是否处于激活
    var menulink = "#";
    if (menu.SubMenu.Count == 0)
    {
        menulink =menu.UrlAddress;
    }
    <li class="nav-item @(isActive?"has-treeview menu-open":"")">
        <a href="@menulink" class="nav-link @(isActive?"active":"")" data-id="@menu.Id">
            <i class="nav-icon @menu.Icon"></i>
            <p>
                @menu.FullName
                <i class="right fa fa-angle-left"></i>
            </p>
        </a>
        @if (menu.SubMenu.Count >0)
        {
        <ul class="nav nav-treeview ">
            @foreach (var smenu in menu.SubMenu)
            {
                isActive = ViewBag.CurrentMenu == smenu.EnCode; //判断当前功能是否处于激活

                <li class="nav-item">
                    <a href="@smenu.UrlAddress" data-id="@smenu.Id" class="nav-link @(isActive?"active":"")">
                        <i class="nav-icon @(!string.IsNullOrEmpty(smenu.Icon)?smenu.Icon:"far fa-circle")"></i>
                        <p>@smenu.FullName</p>
                    </a>
                </li>
            }
        </ul>
        }
    </li>
}
